Page({

  /**
   * 页面的初始数据
   */
  data: {
    phone: "", //手机号
    goHtml: true,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var page = getCurrentPages();
    this.setData({
      phone: options.phone //手机号
    })
  },

  /**
   * 跳转到绑卡成功界面
   */
  goBindCard: function() {
    this.setData({
      goHtml: false
    }, function() {
      var page = getCurrentPages();
      if (page.length == 3) {
        wx.navigateBack({
          delta: 1
        })
      } else {
        wx.redirectTo({
          url: '/pages/memberCenter/cardLIst/index'
        })
      }
    })
  },
  onShow: function() {
    this.setData({
      goHtml: true
    })
  },
  onUnload: function() {
    if (this.data.goHtml) {
      getCurrentPages().pop();
      wx.navigateTo({
        url: '/pages/memberCenter/cardLIst/index'
      })
    }
  },
})